package app.netant.galgame.bangumi.cartoon;

import java.io.IOException;

import cn.lily.com.db.sql.manager.DBOfflineManager;
import cn.lily.com.file.io.FileInputManager;
import cn.lily.com.lang.number.MathUtil;


/**
 * 游戏实体处理
 * @author JiaJ
 * @date 2018年6月14日
 *
 */
public class BangumiCartoonEntity {
	
	private String carID = System.currentTimeMillis()+""+MathUtil.random(3)+"";
	private String carName = "";
	private String carUrl = "";
	private String carMemo = "";
	private String carTags = "";	        
	private String carNameOth = "";	
	private String carType = "";
	private String carNum = "";
	private String carDateStart	= "";
	private String carDateEnd = "";
	private String carDateWeek = "";
	private String carScript = "";	
	private String carShow = "";
	private String carCase = "";	
	private String carLayout = "";	
	private String carRecord = "";
	private String carMaker	= "";
	private String carMusicMaker = "";
	private String carStUrl	= "";
	private String carTv = "";	
	private String carTimeout = "";
	private String carOpera	= "";
	private String carMusic	= "";
	private String carDoctor = "";	
	private String carArtSuper = "";	
	private String carPicSuper = "";
	private String carMovieSuper = "";	
	private String carMusicSuper = "";	
	private String carBoard = "";	
	private String carPaint	= "";
	private String carPersonSet	= "";
	private String carArtSet = "";	
	private String carEffect = "";	
	private String carMusicEffect = "";
	private String carDerect = "";	
	private String carSys = "";	
	private String carEngineSet	= "";
	private String carClip = "";	
	private String carArea = "";
	private String carPlay = "";
	private String carColorSet = "";
	private String carSuper = "";
	private String carItemSet = "";
	private String carIconSet = "";
	private String car3DSuper = "";
	private String carCGSuper = "";
	private String carLang = "";
	
	public void setCarID(String carID) {
		if (this.carID == null || "".equals(this.carID)) {
			this.carID = carID;
		} else {
			this.carID += "," + carID;
		}
	}

	public void setCarName(String carName) {
		if (this.carName == null || "".equals(this.carName)) {
			this.carName = carName;
		} else {
			this.carName += "," + carName;
		}
	}

	public void setCarUrl(String carUrl) {
		if (this.carUrl == null || "".equals(this.carUrl)) {
			this.carUrl = carUrl;
		} else {
			this.carUrl += "," + carUrl;
		}
	}

	public void setCarMemo(String carMemo) {
		if (this.carMemo == null || "".equals(this.carMemo)) {
			this.carMemo = carMemo;
		} else {
			this.carMemo += "," + carMemo;
		}
	}

	public void setCarTags(String carTags) {
		if (this.carTags == null || "".equals(this.carTags)) {
			this.carTags = carTags;
		} else {
			this.carTags += "," + carTags;
		}
	}

	public void setCarNameOth(String carNameOth) {
		if (this.carNameOth == null || "".equals(this.carNameOth)) {
			this.carNameOth = carNameOth;
		} else {
			this.carNameOth += "," + carNameOth;
		}
	}

	public void setCarType(String carType) {
		if (this.carType == null || "".equals(this.carType)) {
			this.carType = carType;
		} else {
			this.carType += "," + carType;
		}
	}

	public void setCarNum(String carNum) {
		if (this.carNum == null || "".equals(this.carNum)) {
			this.carNum = carNum;
		} else {
			this.carNum += "," + carNum;
		}
	}

	public void setCarDateStart(String carDateStart) {
		if (this.carDateStart == null || "".equals(this.carDateStart)) {
			this.carDateStart = carDateStart;
		} else {
			this.carDateStart += "," + carDateStart;
		}
	}

	public void setCarDateEnd(String carDateEnd) {
		if (this.carDateEnd == null || "".equals(this.carDateEnd)) {
			this.carDateEnd = carDateEnd;
		} else {
			this.carDateEnd += "," + carDateEnd;
		}
	}

	public void setCarDateWeek(String carDateWeek) {
		if (this.carDateWeek == null || "".equals(this.carDateWeek)) {
			this.carDateWeek = carDateWeek;
		} else {
			this.carDateWeek += "," + carDateWeek;
		}
	}

	public void setCarScript(String carScript) {
		if (this.carScript == null || "".equals(this.carScript)) {
			this.carScript = carScript;
		} else {
			this.carScript += "," + carScript;
		}
	}

	public void setCarShow(String carShow) {
		if (this.carShow == null || "".equals(this.carShow)) {
			this.carShow = carShow;
		} else {
			this.carShow += "," + carShow;
		}
	}

	public void setCarCase(String carCase) {
		if (this.carCase == null || "".equals(this.carCase)) {
			this.carCase = carCase;
		} else {
			this.carCase += "," + carCase;
		}
	}

	public void setCarLayout(String carLayout) {
		if (this.carLayout == null || "".equals(this.carLayout)) {
			this.carLayout = carLayout;
		} else {
			this.carLayout += "," + carLayout;
		}
	}

	public void setCarRecord(String carRecord) {
		if (this.carRecord == null || "".equals(this.carRecord)) {
			this.carRecord = carRecord;
		} else {
			this.carRecord += "," + carRecord;
		}
	}

	public void setCarMaker(String carMaker) {
		if (this.carMaker == null || "".equals(this.carMaker)) {
			this.carMaker = carMaker;
		} else {
			this.carMaker += "," + carMaker;
		}
	}

	public void setCarMusicMaker(String carMusicMaker) {
		if (this.carMusicMaker == null || "".equals(this.carMusicMaker)) {
			this.carMusicMaker = carMusicMaker;
		} else {
			this.carMusicMaker += "," + carMusicMaker;
		}
	}

	public void setCarStUrl(String carStUrl) {
		if (this.carStUrl == null || "".equals(this.carStUrl)) {
			this.carStUrl = carStUrl;
		} else {
			this.carStUrl += "," + carStUrl;
		}
	}

	public void setCarTv(String carTv) {
		if (this.carTv == null || "".equals(this.carTv)) {
			this.carTv = carTv;
		} else {
			this.carTv += "," + carTv;
		}
	}

	public void setCarTimeout(String carTimeout) {
		if (this.carTimeout == null || "".equals(this.carTimeout)) {
			this.carTimeout = carTimeout;
		} else {
			this.carTimeout += "," + carTimeout;
		}
	}

	public void setCarOpera(String carOpera) {
		if (this.carOpera == null || "".equals(this.carOpera)) {
			this.carOpera = carOpera;
		} else {
			this.carOpera += "," + carOpera;
		}
	}

	public void setCarMusic(String carMusic) {
		if (this.carMusic == null || "".equals(this.carMusic)) {
			this.carMusic = carMusic;
		} else {
			this.carMusic += "," + carMusic;
		}
	}

	public void setCarDoctor(String carDoctor) {
		if (this.carDoctor == null || "".equals(this.carDoctor)) {
			this.carDoctor = carDoctor;
		} else {
			this.carDoctor += "," + carDoctor;
		}
	}

	public void setCarArtSuper(String carArtSuper) {
		if (this.carArtSuper == null || "".equals(this.carArtSuper)) {
			this.carArtSuper = carArtSuper;
		} else {
			this.carArtSuper += "," + carArtSuper;
		}
	}

	public void setCarPicSuper(String carPicSuper) {
		if (this.carPicSuper == null || "".equals(this.carPicSuper)) {
			this.carPicSuper = carPicSuper;
		} else {
			this.carPicSuper += "," + carPicSuper;
		}
	}

	public void setCarMovieSuper(String carMovieSuper) {
		if (this.carMovieSuper == null || "".equals(this.carMovieSuper)) {
			this.carMovieSuper = carMovieSuper;
		} else {
			this.carMovieSuper += "," + carMovieSuper;
		}
	}

	public void setCarMusicSuper(String carMusicSuper) {
		if (this.carMusicSuper == null || "".equals(this.carMusicSuper)) {
			this.carMusicSuper = carMusicSuper;
		} else {
			this.carMusicSuper += "," + carMusicSuper;
		}
	}

	public void setCarBoard(String carBoard) {
		if (this.carBoard == null || "".equals(this.carBoard)) {
			this.carBoard = carBoard;
		} else {
			this.carBoard += "," + carBoard;
		}
	}

	public void setCarPaint(String carPaint) {
		if (this.carPaint == null || "".equals(this.carPaint)) {
			this.carPaint = carPaint;
		} else {
			this.carPaint += "," + carPaint;
		}
	}

	public void setCarPersonSet(String carPersonSet) {
		if (this.carPersonSet == null || "".equals(this.carPersonSet)) {
			this.carPersonSet = carPersonSet;
		} else {
			this.carPersonSet += "," + carPersonSet;
		}
	}

	public void setCarArtSet(String carArtSet) {
		if (this.carArtSet == null || "".equals(this.carArtSet)) {
			this.carArtSet = carArtSet;
		} else {
			this.carArtSet += "," + carArtSet;
		}
	}

	public void setCarEffect(String carEffect) {
		if (this.carEffect == null || "".equals(this.carEffect)) {
			this.carEffect = carEffect;
		} else {
			this.carEffect += "," + carEffect;
		}
	}

	public void setCarMusicEffect(String carMusicEffect) {
		if (this.carMusicEffect == null || "".equals(this.carMusicEffect)) {
			this.carMusicEffect = carMusicEffect;
		} else {
			this.carMusicEffect += "," + carMusicEffect;
		}
	}

	public void setCarDerect(String carDerect) {
		if (this.carDerect == null || "".equals(this.carDerect)) {
			this.carDerect = carDerect;
		} else {
			this.carDerect += "," + carDerect;
		}
	}

	public void setCarSys(String carSys) {
		if (this.carSys == null || "".equals(this.carSys)) {
			this.carSys = carSys;
		} else {
			this.carSys += "," + carSys;
		}
	}

	public void setCarEngineSet(String carEngineSet) {
		if (this.carEngineSet == null || "".equals(this.carEngineSet)) {
			this.carEngineSet = carEngineSet;
		} else {
			this.carEngineSet += "," + carEngineSet;
		}
	}

	public void setCarClip(String carClip) {
		if (this.carClip == null || "".equals(this.carClip)) {
			this.carClip = carClip;
		} else {
			this.carClip += "," + carClip;
		}
	}

	public void setCarArea(String carArea) {
		if (this.carArea == null || "".equals(this.carArea)) {
			this.carArea = carArea;
		} else {
			this.carArea += "," + carArea;
		}
	}

	public void setCarPlay(String carPlay) {
		if (this.carPlay == null || "".equals(this.carPlay)) {
			this.carPlay = carPlay;
		} else {
			this.carPlay += "," + carPlay;
		}
	}
	
	public void setCarColorSet(String carColorSet) {
		if (this.carColorSet == null || "".equals(this.carColorSet)) {
			this.carColorSet = carColorSet;
		} else {
			this.carColorSet += "," + carColorSet;
		}
	}
	
	public void setCarSuper(String carSuper) {
		if (this.carSuper == null || "".equals(this.carSuper)) {
			this.carSuper = carSuper;
		} else {
			this.carSuper += "," + carSuper;
		}
	}
	
	public void setCarItemSet(String carItemSet) {
		if (this.carItemSet == null || "".equals(this.carItemSet)) {
			this.carItemSet = carItemSet;
		} else {
			this.carItemSet += "," + carItemSet;
		}
	}
	
	public void setCarIconSet(String carIconSet) {
		if (this.carIconSet == null || "".equals(this.carIconSet)) {
			this.carIconSet = carIconSet;
		} else {
			this.carIconSet += "," + carIconSet;
		}
	}
	
	public void setCar3DSuper(String car3DSuper) {
		if (this.car3DSuper == null || "".equals(this.car3DSuper)) {
			this.car3DSuper = car3DSuper;
		} else {
			this.car3DSuper += "," + car3DSuper;
		}
	}
	
	public void setCarCGSuper(String carCGSuper) {
		if (this.carCGSuper == null || "".equals(this.carCGSuper)) {
			this.carCGSuper = carCGSuper;
		} else {
			this.carCGSuper += "," + carCGSuper;
		}
	}

	public void setCarLang(String carLang) {
		if (this.carLang == null || "".equals(this.carLang)) {
			this.carLang = carLang;
		} else {
			this.carLang += "," + carLang;
		}
	}
	
	public void addTagValue(String tagName,String tagValue){
		
		tagName = tagName.trim();
		tagValue = this.getString(tagValue.trim());
		
		if("地区".equals(tagName) || tagName.indexOf("国家")>-1){
			this.setCarArea(tagValue);
		}
		
		else if("中文名".equals(tagName) || "别名".equals(tagName) ){
			this.setCarNameOth(tagValue);
		}
		
		else if("话数".equals(tagName)){
			this.setCarNum(tagValue);
		}
		
		else if("监修".equals(tagName)){
			this.setCarDerect(tagValue);
		}
		
		else if("人物设定".equals(tagName) || tagName.indexOf("人物设计")>-1){
			this.setCarPersonSet(tagValue);
		}
		
		else if("分镜".equals(tagName) || "分镜构图".equals(tagName)){
			this.setCarBoard(tagValue);
		}
		
		else if("音响".equals(tagName) || "音响监督".equals(tagName) || tagName.indexOf("音響監督")>-1){
			this.setCarMusicSuper(tagValue);
		}
		
		else if("音效".equals(tagName) || "音响效果".equals(tagName) || "音效合成".equals(tagName)){
			this.setCarMusicEffect(tagValue);
		}
		
		else if(tagName.indexOf("导演")>-1 || "执行制片人".equals(tagName) 
				||"制片人".equals(tagName) ||"总制片".equals(tagName)){
			this.setCarDoctor(tagValue);
		}
		
		else if(tagName.indexOf("脚本")>-1){
			this.setCarScript(tagValue);
		}
		
		else if(tagName.indexOf("企画")>-1){
			this.setCarLayout(tagValue);
		}
		
		else if("时长".equals(tagName) || "片长".equals(tagName)){
			this.setCarTimeout(tagValue);
		}
		
		else if("原作".equals(tagName) || "原案".equals(tagName)){
			this.setCarCase(tagValue);
		}
		
		else if("时间".equals(tagName) || "放送开始".equals(tagName) 
				|| "上映年度".equals(tagName) || "发售日".equals(tagName)
				|| "开始".equals(tagName)){
			this.setCarDateStart(tagValue);
		}
		
		else if("结束".equals(tagName) || "播放结束".equals(tagName)){
			this.setCarDateEnd(tagValue);
		}
		
		else if("美术监督".equals(tagName)){
			this.setCarArtSuper(tagValue);
		}
		
		else if("美术设计".equals(tagName) || tagName.indexOf("背景")>-1){
			this.setCarArtSet(tagValue);
		}
		
		else if(tagName.indexOf("原画")>-1){
			this.setCarPaint(tagValue);
		}
		
		else if("制作管理".equals(tagName)
			  ||"制作公司".equals(tagName)
			  ||"动画制作".equals(tagName)
			  ||"制片".equals(tagName)
			  ||"制片商".equals(tagName)
			  ||"制作".equals(tagName)
			  ||"製作".equals(tagName)
			  ||"助理制片人".equals(tagName)
			  ||"制作助手".equals(tagName)
			  ||"制片担当".equals(tagName)){
			this.setCarMaker(tagValue);
		}
		
		else if(tagName.indexOf("剪辑")>-1){
			this.setCarClip(tagValue);
		}
		
		else if("音乐".equals(tagName) ){
			this.setCarMusic(tagValue);
		}
		
		else if("编剧".equals(tagName) ){
			this.setCarOpera(tagValue);
		}
		
		else if("特效".equals(tagName) ){
			this.setCarEffect(tagValue);
		}
		
		else if("音乐指导".equals(tagName) || "音乐制作".equals(tagName) || "音乐制作人".equals(tagName)){
			this.setCarMusicMaker(tagValue);
		}
		
		else if(tagName.indexOf("录音")>-1 || tagName.indexOf("整音")>-1){
			this.setCarRecord(tagValue);
		}
		
		else if(tagName.indexOf("演出")>-1 || "主演".equals(tagName)){
			this.setCarShow(tagValue);
		}
		
		else if("播放电视台".equals(tagName) || "其他电视台".equals(tagName)){
			this.setCarTv(tagValue);
		}
		
		else if("放送星期".equals(tagName) || "播放星期".equals(tagName)){
			this.setCarDateWeek(tagValue);
		}
		
		else if("机械设定".equals(tagName) || "机械设计".equals(tagName)){
			this.setCarEngineSet(tagValue);
		}
		
		else if("演奏".equals(tagName) ){
			this.setCarPlay(tagValue);
		}
		
		else if("语言".equals(tagName) ){
			this.setCarLang(tagValue);
		}
		
		else if("官方网站".equals(tagName) ){
			this.setCarStUrl(tagValue);
		}
		
		else if(tagName.indexOf("色彩") > -1 ){
			this.setCarColorSet(tagValue);
		}
		
		else if(tagName.indexOf("摄影") > -1 ){
			this.setCarMovieSuper(tagValue);
		}
		
		else if(tagName.indexOf("作画") > -1 ){
			this.setCarPicSuper(tagValue);
		}
		
		else if("系列监督".equals(tagName)||"系列构成".equals(tagName) ){
			this.setCarSys(tagValue);
		}
		
		else if("动画检查".equals(tagName) 
			  ||"監督".equals(tagName)
			  ||"监督助手".equals(tagName)
			  ||"监督".equals(tagName)){
			this.setCarSuper(tagValue);
		}
		
		else if(tagName.indexOf("道具") > -1){
			this.setCarItemSet(tagValue);
		}
		
		else if(tagName.indexOf("标志") > -1 ){
			this.setCarIconSet(tagValue);
		}
		
		else if(tagName.indexOf("CG") > -1 ){
			this.setCarCGSuper(tagValue);
		}
		
		else if(tagName.indexOf("3D") > -1 ){
			this.setCar3DSuper(tagValue);
		}
	}
	
	public void insert() {
		
		String insertSQL = " insert into ${schema}.LEO_BANGUMI_CARTOON_INFO "
				           + "(CAR_ID,CAR_NAME,CAR_URL,CAR_MEMO,CAR_TAG,"
				           + "CAR_NAME_OTH,CAR_TYPE,CAR_NUM,CAR_DATE_START,CAR_DATE_END,"				           
				           + "CAR_DATE_WEEK,CAR_SCRIPT,CAR_SHOW,CAR_CASE,CAR_LAYOUT,"				           
				           + "CAR_RECORD,CAR_MAKER,CAR_MUSIC_MAKER,CAR_ST_URL,CAR_TV,"				           
				           + "CAR_TIMEOUT,CAR_OPERA,CAR_MUSIC,CAR_DOCTOR,CAR_ART_SUPER,"				           
				           + "CAR_PIC_SUPER,CAR_MOVIE_SUPER,CAR_MUSIC_SUPER,CAR_BOARD,CAR_PAINT,"				           
				           + "CAR_PERSON_SET,CAR_ART_SET,CAR_EFFECT,CAR_MUSIC_EFFECT,CAR_DERECT,"		           
				           + "CAR_SYS,CAR_ENGINE_SET,CAR_CLIP,CAR_AREA,CAR_PLAY,"
				           + "CAR_COLOR_SET,CAR_SUPER,CAR_ITEM_SET,CAR_ICON_SET,CAR_3D_SUPER,CAR_CG_SUPER,CAR_LANG) "
				           + " values "
				           + "('"+this.carID+"','"+this.carName+"','"+this.carUrl+"','"+this.carMemo+"','"+this.carTags+"',"
				           + "'"+this.carNameOth+"','"+this.carType+"','"+this.carNum+"','"+this.carDateStart+"','"+this.carDateEnd+"',"
				           + "'"+this.carDateWeek+"','"+this.carScript+"','"+this.carShow+"','"+this.carCase+"','"+this.carLayout+"',"
				           + "'"+this.carRecord+"','"+this.carMaker+"','"+this.carMusicMaker+"','"+this.carStUrl+"','"+this.carTv+"',"
				           + "'"+this.carTimeout+"','"+this.carOpera+"','"+this.carMusic+"','"+this.carDoctor+"','"+this.carArtSuper+"',"
				           + "'"+this.carPicSuper+"','"+this.carMovieSuper+"','"+this.carMusicSuper+"','"+this.carBoard+"','"+this.carPaint+"',"
				           + "'"+this.carPersonSet+"','"+this.carArtSet+"','"+this.carEffect+"','"+this.carMusicEffect+"','"+this.carDerect+"',"
				           + "'"+this.carSys+"','"+this.carEngineSet+"','"+this.carClip+"','"+this.carArea+"','"+this.carPlay+"',"
				           + "'"+this.carColorSet+"','"+this.carSuper+"','"+this.carItemSet+"','"+this.carIconSet+"','"+this.car3DSuper+"',"
				           + "'"+this.carCGSuper+"','"+this.carLang+"')";
		
		DBOfflineManager.getDBManager().executeUpdate(insertSQL);
		
	}
	
	protected String getString(String src){
		return src.replaceAll("'", "’")
				  .replaceAll("\"", "”")
				  .replaceAll("&nbsp;", "")
				  .replaceAll("<br>", "")
				  .replaceAll("<br/>", "")
				  .replaceAll("<p>", "")
				  .replaceAll("</p>", "");
	}
	
	public static void main(String[] args) throws IOException {
		FileInputManager fim = new FileInputManager();
		fim.loadFile("D:/dd.txt");
		String line = fim.readLine();
		while(line != null){
			
			String name = line.substring(0,line.indexOf("=")).trim();
			String tmp = name.substring(0,1).toUpperCase()+name.substring(1);
			
			System.out.println(" public void set"+tmp+"(String "+name+") {                ");
			System.out.println(" 	if(this."+name+" == null || \"\".equals(this."+name+")){ ");
			System.out.println(" 		this."+name+" = "+name+";                          ");
			System.out.println(" 	}else{                                                 ");
			System.out.println(" 		this."+name+" += \",\" + "+name+";                   ");
			System.out.println(" 	}                                                      ");
			System.out.println(" }                                                         ");
			
			line = fim.readLine();
			
			
			
		}
	}
}
